import { MockMethod } from 'vite-plugin-mock';
import { resultSuccess } from '../_util';

const articleInfo = {
  draft_id: undefined,
  author_user_info: {
    avatar: '@image()',
    user_id: '@natural(0,100000000)',
  },
  article_draft: {
    article_id: '@natural(0,100000000)',
    brief_content: '@cparagraph()',
    title: '@ctitle()',
  },
};

export default [
  {
    url: '/basic-api/article_draft/detail',
    timeout: 500,
    method: 'post',
    response: ({ body }) => {
      const { draft_id } = body;
      articleInfo.draft_id = draft_id;
      return resultSuccess(articleInfo);
    },
  },
] as MockMethod[];
